home *** CD-ROM | disk | FTP | other *** search
/ VRML 2.0 Sourcebook (2nd Edition) / VRML 2.0 Sourcebook CD [md5 fed90f4f9c39d5a60d477058775c7e21].iso / book / win / ch09 / 09fig09.wrl < prev   
Text File  |  1996-09-23  |  4KB  |  103 lines

  1. #VRML V2.0 utf8
  2. # The VRML 2.0 Sourcebook
  3. # Copyright [1997] By
  4. # Andrea L. Ames, David R. Nadeau, and John L. Moreland
  5. Group {
  6.   children [
  7.   # Lamp
  8.     DEF MoveLamp PlaneSensor { },
  9.     DEF Lamp Transform {
  10.       children [
  11.       # Lamp base
  12.         Shape {
  13.           appearance DEF White Appearance {
  14.             material Material { }
  15.           }
  16.           geometry Cylinder {
  17.             radius 0.1
  18.             height 0.01
  19.           }
  20.         },
  21.       # Base - First arm joint
  22.         Group {
  23.           children [
  24.             DEF MoveFirstArm SphereSensor {
  25.               offset 1.0 0.0 0.0 -0.7
  26.             },
  27.             DEF FirstArm Transform {
  28.               translation 0.0 0.15 0.0
  29.               rotation    1.0 0.0 0.0  -0.7
  30.               center      0.0 -0.15 0.0
  31.               children [
  32.               # Lower arm
  33.                 DEF LampArm Shape {
  34.                   appearance USE White
  35.                   geometry Cylinder {
  36.                     radius 0.01
  37.                     height 0.3
  38.                   }
  39.                 },
  40.               # First arm - second arm joint
  41.                 Group {
  42.                   children [
  43.                     DEF MoveSecondArm SphereSensor {
  44.                       offset 1.0 0.0 0.0 1.9
  45.                     },
  46.                     DEF SecondArm Transform {
  47.                       translation 0.0 0.3 0.0
  48.                       rotation  1.0 0.0 0.0  1.9
  49.                       center    0.0 -0.15 0.0
  50.                       children [
  51.                       # Second arm
  52.                         USE LampArm,
  53.                       # Second arm - shade joint
  54.                         Group {
  55.                           children [
  56.                             DEF MoveLampShade SphereSensor {
  57.                               offset 1.0 0.0 0.0 -1.25
  58.                             },
  59.                             DEF LampShade Transform {
  60.                               translation 0.0 0.075 0.0
  61.                               rotation  1.0 0.0 0.0  -1.25
  62.                               center    0.0 0.075 0.0
  63.                               children [
  64.                               # Shade
  65.                                 Shape {
  66.                                   appearance USE White
  67.                                   geometry Cone {
  68.                                     height 0.15
  69.                                     bottomRadius 0.12
  70.                                     bottom FALSE
  71.                                   }
  72.                                 },
  73.                               # Light bulb
  74.                                 Transform {
  75.                                   translation 0.0 -0.05 0.0
  76.                                   children Shape {
  77.                                     appearance USE White
  78.                                     geometry Sphere {
  79.                                       radius 0.05
  80.                                     }
  81.                                   }
  82.                                 }
  83.                               ]
  84.                             }
  85.                           ]
  86.                         }
  87.                       ]
  88.                     }
  89.                   ]
  90.                 }
  91.               ]
  92.             }
  93.           ]
  94.         }
  95.       ]
  96.     }
  97.   ]
  98. }
  99. ROUTE MoveLamp.translation_changed   TO Lamp.set_translation
  100. ROUTE MoveFirstArm.rotation_changed  TO FirstArm.set_rotation
  101. ROUTE MoveSecondArm.rotation_changed TO SecondArm.set_rotation
  102. ROUTE MoveLampShade.rotation_changed TO LampShade.set_rotation
  103.